//throw return 
function* gen() {
    console.log(1)
    yield 'a';
    console.log(2)
    yield 'b';
    console.log(3)
    yield 'c';
    console.log(4)
    return 'd'
}
let it = gen();
console.log(it.next());
console.log(it.next());
//结束生成器
//console.log(it.return('结果'));
it.throw(new Error('出错了'));
console.log(it.next());
console.log(it.next());